package org.lee.basic.algorithm;

import java.util.Scanner;

/**
 * @author jackielee
 * @version 1.0
 * @description MaxMin1
 * @date 2021/4/19
 */
public class MaxMin1 {
  public static void main(String[] args) {
    MaxMin(2, 4);
  }

  static void MaxMin(int a, int b) {
    int gy = 1;
    int gb = a * b;
    int temp = 1;
    String tip = a + "和" + b;
    if (b < a) {
      temp = a;
      a = b;
      b = temp;
    }
    while (a != 0) {
      temp = b % a; // 大%小
      b = a;
      a = temp;
    }
    gy = b;
    gb /= b;
    System.out.println(tip + "最大公约数：" + gy);
    System.out.println(tip + "最小公倍数：" + gb);

    try (Scanner s = new Scanner(System.in)) {
      String line;
      do {
        line = s.nextLine();
        System.out.println("input:" + line);
      } while (!"exit".equals(line));
    }
  }
}
